﻿namespace NetActive.Notifications.Services.WP7.Interfaces
{
    public interface INotificationService
    {
        /// <summary>
        /// Gets or sets the maximum number of times the service attempts to send a given notification.
        /// Please note after every failed attempt the delay is increased exponentialy.
        /// </summary>
        int MaxNumberOfRetryAttempts { get; set; }

        /// <summary>
        /// Method used to asynchronously send the given <paramref name="notification"/>. Once completed the <see cref="NotificationSent"/> event is raised.
        /// This method automatically handles resending of the notification, if usefull.
        /// </summary>
        /// <param name="notification">Notification to send.</param>
        void Send(INotification notification);

        /// <summary>
        /// Method used to asynchronously send all given <paramref name="notifications"/>. For every individual notification, once completed the <see cref="INotificationService.NotificationSent"/> event is raised.
        /// This method automatically handles resending of notifications, if usefull.
        /// </summary>
        /// <param name="notifications">Notifications to send.</param>
        void Send(INotification[] notifications);

        /// <summary>
        /// This event is raised, when the maximum number of retry attempts for a notification has exceeded without success.
        /// </summary>
        event NotificationService.MaxNumberOfRetryAttemptsExceededEventHandler MaxNumberOfRetryAttemptsExceeded;

        /// <summary>
        /// This event is raised, when a notification was sent successfully.
        /// </summary>
        event NotificationService.NotificationSentEventHandler NotificationSent;

        /// <summary>
        /// This event is raised, when the channel registered for the given recipient is expired.
        /// The handler of this event should drop the subscription state for its corresponding application session.
        /// </summary>
        event NotificationService.ChannelExpiredEventHandler ChannelExpired;
    }
}